<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Usuarios de Oracle</title>
        <link rel="shortcut icon" href="../Data/images/Saved-Data-Utility.ico" type="image/x-icon"/>
        <link rel="stylesheet" href="../Data/CSS/content.css" type="text/css"/>
    </h:head>
    <h:body>
        <h:form id="formlistUser">
           <p:growl id="growlTU" showDetail="true" life="10000" autoUpdate="true"/>
            <h:panelGrid style="margin: 0 auto">
                <p:outputLabel value="ADMINISTRACION DE USUARIOS" style="color: #2480BC;"/>
                <br></br>
                <br></br>
            </h:panelGrid>
            <p:growl id="msgLTS" showDetail="true" life="10000"/>
            <p:panel header="Listado de Usuarios" style="text-align: center">
                <h:panelGrid columns="1" style="margin: 0 auto;width: 1500px">
                <p:dataTable id="dataTableUsers" var="user" 
                             value="#{tableUser.mediumUserModel}" 
                            paginator="true" rows="15"
                            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                            rowsPerPageTemplate="5,10,15"
                            selection="#{tableUser.selectedUser}"
                            selectionMode="single"
                            rowKey="#{user.compositeKey}">
                    <p:column headerText="Usuario">  
                        <h:outputText value="#{user.name}" />  
                    </p:column>  

                    <p:column headerText="Servidor">  
                        <h:outputText value="#{user.host}" />  
                    </p:column>  

                    <p:column headerText="Contrasena">  
                        <h:outputText value="#{user.password}" />  
                    </p:column>  
                    <p:column headerText="Grant">  
                        <h:outputText value="#{user.grant}" />  
                    </p:column>  
                </p:dataTable>
                </h:panelGrid>
            </p:panel>
            <h:panelGrid style="margin: 0 auto" columns="2" >
                <p:outputLabel value="Borrar Usuario Seleccionado: "/>
                <p:commandButton value="Drop" style="color: #2480BC;"  action="#{tableUser.drop()}" oncomplete="carDialog2.show()" update=":dropuser:mess">
                    <p:confirm header="Confirmation" message="Esta Seguro de Realizar Esta accion?" icon="ui-icon-alert" /> 
                </p:commandButton>   
                <p:confirmDialog global="true" showEffect="fade" hideEffect="explode">  
                    <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>  
                    <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>       
                </p:confirmDialog> 
            </h:panelGrid>
        </h:form>
                <!-- CAR DIALOGS -->
        <h:form id="dropuser">
            <p:dialog header="Atencion!!" 
                      widgetVar="carDialog2" 
                      position="center" 
                      modal="false"  
                      visible="false" 
                      showEffect="explode" 
                      hideEffect="explode" 
                      resizable="true" 
                      closable="false" >  
                <p:outputPanel id="carDetail" style="text-align:center;" layout="block">   
                    <h:panelGrid>  
                        <h:outputText value = "#{tableUser.message}" id="mess" style="text-align: center"/>
                        <p:commandButton value="Aceptar"  update=":formlistUser:dataTableUsers" oncomplete="carDialog2.hide()"/>
                    </h:panelGrid>  
                </p:outputPanel>  
            </p:dialog>
        </h:form>
    </h:body>
</html>
